package jvm

/**
 * @Author: DRevelation
 * @Date: 2021/9/22 17:55
 */

class Man {
    var lastName: String = "zhang"
        get() = field.uppercase()

    var no: Int = 100
        set(value) {
            field = if (value < 10) {
                value
            } else {
                -1
            }
        }
    var heiht: Float = 145.4f
        private set
}

fun main() {
    val person = Man()
    person.lastName = "wang"
    println("lastName:${person.lastName}")

    person.no = 9
    println("no:${person.no}")

    person.no = 20
    println("no:${person.no}")
}